3rdstagefandomcom-20200214-history
On Blockchain
__TOC__ General * Blockchain ** a distributed database that maintains a continuously-growing list of records called blocks. * A Next-Generation Smart Contract and Decentralized Application Platform * How Bitcoin Works Under the Hood (July 14, 2013) * Private blockchain * On Public and Private Blockchains (August 7th, 2015) * What are the best open source projects to study blockchain technology in terms of simplicity? * What is the best programming language to learn if you want to work on the blockchain? * Bitcoin mining the hard way: the algorithms, protocols, and bytes * A 101 Noob Intro to Programming Smart Contracts on Ethereum * [https://www.linkedin.com/pulse/blockchain-database-adi-ben-ari Blockchain as a Database] (July 31, 2015) * Cryptocurrency tumbler ** a service offered to mix potentially identifiable or 'tainted' cryptocurrency funds with others, so as to obscure the trail back to the fund's original source. * State of the ÐApps * Blockchain Use Case Failure: 43 Projects and Zero Impact (December 10, 2018) * Blockchain Events and Conferences * Mnemonic Code Converter * BIP32 Deterministic Key Generator Consensus Algorithm PoW * Proof-of-Work, Explained (JAN 17, 2018) pBFT RAFT * The Raft Consensus Algorithm Blockchian Networks Smart Contract * Smart Contract (on Wikipedia) Key and Wallet * Cryptocurrency wallet * Deterministic Wallets, Their Advantages and their Understated Flaws (November 26, 2013, Vitalik Buterin) * Shamir's Secret Sharing ** a form of secret sharing, where a secret is divided into parts, giving each participant its own unique part. Business Concepts * Debits and credits * What Is Margin Trading? (13.01.2020) ** This ability to expand trading results makes margin trading especially popular in low-volatility markets, particularly the international Forex market. Still, margin trading is also used in stock, commodity, and cryptocurrency markets. * Margin (Jun 25, 2019) Financial Instrument * Financial instrument ** monetary contracts between parties which can be created, traded, modified and settled. Bitcoin * Bitcoin Developer Guide * Mastering Bitcoin (O'reilly, Andreas M. Antonopoulos) * Bitcoin Wiki Proof of Work * Proof of work * The Proof-of-Work Concept (June 24, 2013) * Bitcoin mining the hard way: the algorithms, protocols, and bytes BIP * BIPs (Bitcoin Improvement Proposals) HD Wallet BIP 32 * BIP 32 * Each leaf node in the tree corresponds to an actual key, while the internal nodes correspond to the collections of keys that descend from them. * The chain codes of the leaf nodes are ignored, and only their embedded private or public key is relevant. * Knowing an extended private key allows reconstruction of all descendant private keys and public keys. * Knowing an extended public keys allows reconstruction of all descendant non-hardened public keys. Serialization Format Ethereum * Ethereum Wiki * Ethereum White Paper : A Next-Generation Smart Contract and Decentralized Application Platform * Ethereum Design Rationale * Ethereum Yello Pager * Ethereum Beige Paper * Differences Between a White Paper, Yellow Paper, and Beige Paper (Aug 2, 2018) * Learn about Ethereum * Developer Resources * Ethereum Developer Tools List * Ethereum Development Tutorial * Ethereum Hard Forks ** Frontier, Homestead, Byzantium, Petersburg, Constantinople * Ethereum Homestead Documentation ** the reference documentation accompanying the Homestead release of the Ethereum project. * Ethereum Builder's Guide * Ethereum Frontier Guide * Awesome Ethereum Virtual Machine * Hard Problems in Cryptocurrency: Five Years Later (Nov 22, 2019) * Enterprise Ethereum Architecture Stack Launched (May 2, 2018) * Small universal Turing machines * Trapdoor function * Discrete logarithm Specs * Ethereum Natural Specification Format * Ethereum Chain Spec Format ** Subformat: genesis * Enode URL format EIP * EIPs (Ethereum Improvement Proposals) ** describe standards for the Ethereum platform, including core protocol specifications, client APIs, and contract standards. * EIP List ERC * ERC : Application-level standards and conventions +--- Transferrable ---------- EIP 20 | +--- Fungible -------+ | | | +--- Non Transferrable ----- | +---+ | | +--- Transferable ---------- EIP 721 | | +--- Non Fungible ---+ | +--- Non Transferrable ----- ERC 1238, ERC 735 * ERC-1155: The Crypto Item Standard (Jun 25, 2018) * Can ERC-1155 Replace ERC-20 And 721 As The New Standard (Jun 25, 2018) Concepts * Ether ** 1 wei = 10-18 ether ** 1 Gwei (shannon) = 109 wei = 10-9 ether * Account Types, Gas, and Transactions ** Externally Owned Account, Contract Account, Transaction, Message, Gas * What is Gas? * What is coinbase? (Apr 16 '16) * The address of that contract is not the zero address but an address derived from the sender and its number of transactions sent (the “nonce”). * The gas price is a value set by the creator of the transaction, who has to pay gas_price * gas up front from the sending account. If some gas is left after the execution, it is refunded to the creator in the same way. * The Ethereum Virtual Machine has three areas where it can store data- storage, memory and the stack * Decentralized Autonomous Organization (DAO) ** an organization represented by rules encoded as a computer program that is transparent, controlled by shareholders and not influenced by a central government. Keys and Address A(pr)=B96...256(KEC(ECDSAPUBKEY(pr))) A : address pr : private key KEC : Keccak-256 hash function * [https://medium.com/@jeancvllr/solidity-tutorial-all-about-addresses-ffcdf7efc4e7 Solidity Tutorial : all about Addresses] * Accounts, Addresses, Public And Private Keys, And Tokens * Understanding the concept of Private Key, Public Key and Address in Ethereum Blockchain (2017/11/17) * Location of public and private keys of Ethereum account (Apr 25 '17) ** The private key is never (or should never be) saved unencrypted on disk. It is generated from the info in the keystore file when the user enters the password. * how to produce enode from node key? (Oct 21 '17) ** bootnode -nodekeyhex 59233b25bfa4c214a8713e07a395a5d11478de10f36c6c80ba5369541f73bc44 -writeaddress * Create full Ethereum wallet, keypair and address (Feb 15, 2017) * What does v, r, s in eth_getTransactionByHash mean? (May 3 '17) * Get public key of any ethereum account (Mar 31 '17) * Can I deploy a contract to an arbitrary address that I choose? (Oct 26 '16) * Signing and Verifying Ethereum Signatures (Nov. 21, 18) * secp256k1 ** the parameters of the elliptic curve used in Bitcoin's public-key cryptography, and is defined in Standards for Efficient Cryptography (SEC) (Certicom Research, http://www.secg.org/sec2-v2.pdf) * Elliptic Curve Digital Signature Algorithm (ECDSA) (Wikipedia) * Elliptic Curve Digital Signature Algorithm (BitCoin Wiki) * Keccak * SHA-3 Account State Transaction * Transaction types * Life Cycle of an Ethereum Transaction (Dec 27, 2017) * Transaction signature Signature = Fsig(Fkeccak256(m), k) = (r, s) m : encoded transaction k : signer's private key Fkeccak256 : Keccak-256 hash function Fsig : Signing algorithm Block Block Header Merkle Patricia Tree * Trie * Merkle Patricia Tree * Where is the state data stored?(Jan 22 '16) * Why Merkle-Patricia Trie has three types of nodes? (Aug 26 '18) Consensus * Introduction to PBFT * PBFT (Practical Byzantine Fault Tolerance, pBFT) * Safety and Liveness — Blockchain in the Point of View of FLP Impossibility (May 26, 2018) * Liveness * Safety Misc * Hundreds of Millions of Dollars Locked at 0x0 Address and Smart Contracts’ Addresses — How, Why and What to do? (Jan 13 '18) Hard Forks * Ethereum’s Istanbul Hard Fork Is Now Live (Dec 8, 2019) ** Ethereum has successfully completed the Istanbul hard fork. * Muir Glacier: Ethereum Hard Forks for Second Time in One Month (Jan 2, 2020) ** Ethereum has completed its second hard fork in less than 30 days. Ethereum 2.0 * Ethereum 2.0 (Serenity) Phases * Ewasm Design Overview and Specification * Ethereum 2.0 Info * Proof of Stake FAQ * Sharding FAQ * Ethereum 2.0 Specifications * ETH 2 Phase 2 WIKI * Phase 2 Proposal 2 * What you can do for Ethereum 2.0 a.k.a. sharding (June 12th, 2018) * State of Ethereum Protocol #1 (Aug 29, 2018) * State of Ethereum Protocol #2: The Beacon Chain (Oct 27, 2018) * Ethereum 2.0: A Complete Guide. Scaling, Part One (Jun 20, 2019) ** Plasma Chains, State Channels * Ethereum 2.0: A Complete Guide. Scaling Ethereum — Part Two: Sharding (Jul 11 2019) * Ethereum 2.0: A Complete Guide. Casper and the Beacon Chain (Aug 6 2019) * Two Point Oh: Explaining Validators (02 November 2018) * Two Point Oh: The Beacon Chain (21 November 2018) * A Journey Through Phase 2 of Ethereum 2.0 * The Future of Ethereum: A Scaling Roadmap to Casper, Plasma, and Sharding (JANUARY 8, 2019) * Making Sense of Ethereum’s Layer 2 Scaling Solutions: State Channels, Plasma, and Truebit (Feb 12, 2018) * 2019 Blockchain Layer 2 Solution Review (February 27th 2019) Casper * [https://arxiv.org/pdf/1710.09437.pdf Casper the Friendly Finality Gadget] (Vitalik and Virgil's Paper) ** Casper the Friendly Finality Gadget v1 (25 Oct 2017) * Casper The Friendly Finality Gadget (Vitalik's Notes) * Casper FFG: Consensus Protocol for the Realization of Proof-of-Stake * Ethereum Casper: A Comprehensive Guide * Casper FFG Overview (Korean) * Minimal Slashing Conditions (Mar 2, 2017) * Cryptocurrencies without Proof of Work * Convenience link to Casper+Sharding chain v2.1 spec (Jun '18) * A CBC Casper Tutorial (Dec 5, 2018) Misc * The Stateless Client Concept JSON RPC APIs * JSON RPC API (Generic) ** A transaction object * Looking around the local client using JSON RPC API $ # Get the client version. (https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion) $ curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://127.0.0.1:8545 $ # Get the network ID. (https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version) $ curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}' http://127.0.0.1:8545 $ # Get the number of peers currently connected to the client. (https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount) $ curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}' http://127.0.0.1:8545 $ # Get the Ethereum protocol version. (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion) $ # For more on Ethereum protocol version, refer https://github.com/ethereum/devp2p/blob/master/caps/eth.md $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":67}' http://127.0.0.1:8545 $ # Get the client coinbase address. (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase) $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":64}' http://127.0.0.1:8545 $ # Check whether the client is mining or not. (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining) $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_mining","params":[],"id":71}' http://127.0.0.1:8545 $ # https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice $ # https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts $ # https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber $ # Get information about a block by block number. (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber) $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":false,"id":1}' http://127.0.0.1:8545 | jq . # block 0 $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":false,"id":2}' http://127.0.0.1:8545 | jq . # block 1 $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":false,"id":3}' http://127.0.0.1:8545 | jq . # block 1 JavaScript API * JavaScript API (web3.js) 1.2.4 * JavaScript API (web3.js) 1.0 * JavaScript API (web3.js) 0.2.x.x * Management APIs * Looking around the current network truffle(ropsten)> web3.eth.getCoinbase().then() ... truffle(ropsten)> web3.eth.getGasPrice() ... truffle(ropsten)> web3.eth.getAccounts().then() // list all the accounts controlled by current node ... truffle(ropsten)> web3.eth.getAccounts().then(accts => accts0) //access the first account ... truffle(ropsten)> web3.eth.getBlockNumber().then() 7001069 truffle(ropsten)> web3.eth.getNodeInfo() 'Geth/v1.9.9-omnibus-e320ae4c-20191206/linux-amd64/go1.13.4' truffle(ropsten)> web3.eth.net.getId().then() 3 truffle(ropsten)> web3.eth.net.getPeerCount().then() 100 Programming * A Gentle Introduction to Ethereum Programming, Part 1 (Nov 15, 2017) * A Gentle Introduction to Ethereum Programming, Part 2 (Nov 17, 2017) * A Gentle Introduction to Ethereum Programming, Part 3 (Jan 13, 2018) * How can I get the data of the latest 10 blocks via web3.js? (Feb 25 '16) ** web3.eth.getBlock(web3.eth.blockNumber - i) Clients * GETH & ETH Command line tools for the Ethereum Network * How to call “geth attach” on --testnet better than writing full path? (Jan 9 '17) ** geth attach http://127.0.0.1:8545 Test Network, Private Network * Running geth ** Full node on the main Ethereum network, Full node on the Ethereum test network, Operating a private network * Private network * The Geth’s saga: setting up Ethereum private network on windows (Sep 25, 2017) * Setting up private network or local cluster * Running Ethereum testnet using Geth * Ethereum testnets * ethereum-private-network ** Instructions on how to setup an ethereum private network * ADDING NODES TO YOUR PRIVATE BLOCKCHAIN * [https://ethereum.stackexchange.com/a/2377 Genesis block Explanation] Services * a Block Explorer and Analytics Platform for Ethereum Recommendations * 5 Essential Ethereum Dapp Tools * 11 Best Ethereum Development Tools to Grow Your Stack (Feb 25, 2017) Hackings * Parity Multisig Hacked. Again (Nov 8, 2017) ** About $300M is frozen and (probably) lost forever. misc * Example genesis.json Ethereum Network Statistics * Etherscan > Ethereum Charts & Statistics * Etherscan > Top Statistics * Ethereum Mainnet Statistics ** Clients, Countries, Sync Status, OS, Network Type Solidity * https://github.com/ethereum/solidity * Desc. : a contract-oriented, high-level language for implementing smart contracts * License : GPL v3.0 * Sources : https://github.com/ethereum/solidity/ References * Solidity (on Wikipedia) ** an object-oriented programming language for writing smart contracts. * Solidity v0.6.x official documentation ** Solidity v0.6.0 Breaking Changes *** Function overriding should be explicit. - virtual, override keywords *** Array's length property become immutable. *** Abstract contract should be explicit. - abstract keyword *** State variable shadowing become disallowed. * Solidity v0.5.x official documentation ** Solidity v0.5.0 Breaking Changes *** Function visibility (external, public, internal, private) should be explicit. *** Data location for reference types (struct, array, mapping) should be explicit. *** Conversion from contract type to address should be explicit. - address(contract).balance *** Explicit conversion between unrelated contract types are disallowed. *** Split address type into address type and address payable type. *** For a contract c, address© is address payable iff c has payable fallback function. * Standard library (draft) * Change Log * Common Patterns * Ethereum Contract ABI * Solidity Grammar in Extended BNF * Solidity Grammar in BNF for IntelliJ * Solidity Tutorials * Solidity Tutorials * Learn Solidity in Y minutes * How To Learn Solidity: The Ultimate Ethereum Coding Guide * Writing Smart Contracts with Solidity 0.5 and Above * Solidity Recommendations Grammar Contract = State Variable*, Function*, Function Modifier*, Event*, Struct Type*, Enum Type* function () {internal|external} view|payable () * Value Types ** Value types will always be passed by value * Reference Types ** Every reference type, i.e. arrays and structs, has an additional annotation, the “data location”, about where it is stored. ** All complex types must now give an explicit data location. * Functions ** Functions may also return an arbitrary number of values as output. ** Data location must be memory for return parameter in function * Constructors ** Before the constructor code is executed, state variables are initialised to their specified value if you initialise them inline, or zero if you do not. ** After the constructor has run, the final code of the contract is deployed to the blockchain. ** The constructors of all the base contracts will be called following the linearization rules explained below. * ''Mappings can only have a data location of storage and thus are allowed for state variables, as storage reference types in functions, or as parameters for library functions. They cannot be used as parameters or return parameters of contract functions that are publicly visible.'' Visibility * Visibility Mutability Types * Types Value Types =Address Type = * Members of Address Types * Members of Addresses Reference Types =Array Type = * bytes ** similar to but cheaper than bytes[] ** packed tightly in calldata and memory. ** should be used for arbitrary-length raw byte data * string ** equal to bytes ** not allow length or index access ** should be used for for arbitrary-length UTF-8 data ** no built-in manipulation function ** comparing two strings : keccak256(abi.encodePacked(s1)) keccak256(abi.encodePacked(s2)) ** concatenating two strings : abi.encodePacked(s1, s2) Data Location * Data location * All complex types must now give an explicit data location when used in function parameter, local variable. * Data location for complex type contract member variable is always storage implicitly. (?) Literal * Default Values * default value : initial value whose byte-representation is all zeros * [https://solidity.readthedocs.io/en/v0.5.15/control-structures.html#scoping-and-declarations Scoping and Declarations * What are the initial/zero values for different data types in Solidity? (Feb 22 '18) Special Variables and Functions Error Handling * Error handling: Assert, Require, Revert and Exceptions * Solidity performs a revert operation (instruction 0xfd) for a require-style exception and executes an invalid operation (instruction 0xfe) to throw an assert-style exception. In both cases, this causes the EVM to revert all changes made to the state. * assert-style exceptions consume all gas available to the call, while require-style exceptions do not consume any gas starting from the Metropolis release. Events * The Log and its event data is not accessible from within contracts (not even from the contract that created them) Readings Grammar * What is the zero, empty or null value of a struct? (Feb 2 '16) * How to test if a struct state variable is set (Jan 24 '17) * What is the zero value for a string? (Jun 5 '16) * How can you share a struct definition between contracts in separate files? (Sep 27 '17) * Solidity tutorial: returning structs from public functions (Jul 12, 2017) ** In the current version of Solidity (0.4.13, as of this writing), it’s impossible to return a struct from a public function. * Returning Struct Array in solidity (Dec 22 '18) * Ethereum Solidity: Memory vs Storage & When to Use Them (Mar 18, 2018) * Is it possible to have enum as a mapping key type? (Nov 17 '16) * How to concatenate strings in solidity? (Jan 28 '16) Call * Ethernaut Lvl 6 Delegation Walkthrough: How to abuse the delicate delegatecall (Aug 22, 2018) * [http://getoutsidedoor.com/2019/09/01/delegatecall-in-solidity/ DelegateCall: Calling Another Contract Function in Solidity] (2019/09/01) Debugging * Remix / Debugging transactions Guidelines * Slither Detector Documentation * Solhint List of Rules * SWC Registry Smart Contract Weakness Classification Tools * Solidity browser based compiler * Javascript bindings for the solidity compiler ** compile function * What are *C*, *E* and *S* properties in message call return object? (Aug 1 '16) : BigNumber Libraries * Library Driven Development in Solidity (13 February 2017) * Proxy Libraries in Solidity (Mar 6, 2017) * A place for all the ÐApps to live Patterns * Proxy Patterns (APRIL 19, 2018) * ZeppelinOS Upgrades Pattern * Solidity DelegateProxy Contracts (May 17, 2018) * State Machine Pattern Examples * OpenZeppelin ERC-20 implementation * ConsenSys ERC-20 implementation * Voting * Ethereum Pet Shop Collections * [https://github.com/bkrem/awesome-solidity awesome-solidity] : A curated list of awesome Solidity resources, libraries, tools and more misc * Library Driven Development in Solidity * How do oracle services work under the hood? (Jan 23 '17) * Solidity Tutorial : all about Comments (Aug 1, 2019) Libraries Fixidity * https://github.com/CementDAO/Fixidity * Desc. : A fixed point mathematics library for Solidity * License : MIT Ethereum Clients * Ethereum Mainnet Statistics > Clients Go Ethereum * https://github.com/ethereum/go-ethereum * Desc. : Official golang implementation of the Ethereum protocol * License References * Go Ethereum Wiki * geth Command Line Options * JavaScript Console ** $ geth attach ipc:/some/custom/path, $ geth attach http://191.168.1.1:8545, $ geth attach ws://191.168.1.1:8546 * JSON RPC API (web3, net, eth, db, ssh) * JavaScript API * Management APIs (admin, debug, miner, personal, txpool) Readings * Executing custom JavaScript Snippets through Non-Interactive console (geth --exec) (Jun 24 '16) ** geth --exec "personal.unlockAccount('$addr', '$passwd', 0)" --verbosity 4 attach http://127.0.0.1:$rpc_port Ethereumj * https://github.com/ethereum/ethereumj * Desc. : a pure-Java implementation of the Ethereum protocol * License : LGPL v3.0 Parity Ethereum * https://www.parity.io/ * Desc. : an Ethereum client, written from the ground-up for correctness-verifiability, modularisation, low-footprint and high-performance * License : GPL v3.0 * Written in : Rust * Sources : https://github.com/paritytech/parity Readings * Parity official documentation * What's the difference between the Parity-Ethereum and the Parity client? (Jan 29, 2019) Pantheon * https://pegasys.tech/ * Desc. : public chain compatible, with a more modular architecture and roadmap to add privacy, permissioning, and new consensus algorithms. * License : Apache 2.0 * Written in : Java * Sources ** https://github.com/PegaSysEng/pantheon Readings * Pantheon official documentation * Scaling Consensus for Enterprise: Explaining the IBFT Algorithm * Istanbul Byzantine Fault Tolerance Quorum * https://www.jpmorgan.com/global/Quorum * Desc. : an Ethereum-based distributed ledger protocol with transaction/contract privacy and new consensus mechanisms * License : LGPL v3.0 + GPL v3.0 * Written in : * Sources : ** https://github.com/jpmorganchase/quorum ** https://github.com/jpmorganchase/constellation References * Quorum wiki ** Running Quorum * Provisioning ** Getting Set Up ** Running Quorum ** Installing and running Constellation ** Constellation Configuration Sample ** Quorum Examples Readings * BUILDING DAPPS FOR QUORUM: PRIVATE ENTERPRISE BLOCKCHAINS * Raft-based consensus for Ethereum/Quorum * Gas price issue in Quorum Ethereum Libraries and Tools solc-js * JavaScript bindings for the Solidity compiler * Desc. : https://github.com/ethereum/solc-js * License : MIT License web3j * https://web3j.io/ * Desc. : a lightweight, highly modular, reactive, type safe Java and Android library for working with Smart Contracts and integrating with clients (nodes) on the Ethereum network * License : Apache License 2.0 * Written in : Java * Sources ** https://github.com/web3j/web3j ** https://github.com/web3j/quorum ** https://github.com/web3j/examples References * web3j official documentation * APIs and Classes extends +------------ Ethereum JsonRpc2_0Web3j ---------------- Web3j ---| implements +------------ Web3jRx extends Readings * Deploying and interacting with smart contracts ** Creation of a smart contract ** Transacting with a smart contract ** Querying the state of a smart contract ethereumjs-tx * https://github.com/ethereumjs/ethereumjs-tx * Desc. : A simple module for creating, manipulating and signing ethereum transactions * License : MPL-2.0 * Written in : JavaScript Readings * API LightWallet * https://github.com/ConsenSys/eth-lightwallet * Desc. : Lightweight JS Wallet for Node and the browser * License : MIT * Written in : JavaScript Truffle * http://truffleframework.com/ * Desc. : a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier * License : MIT * Sources : https://github.com/trufflesuite/truffle References * Truffle official documentation * Command Reference * [http://truffleframework.com/docs/getting_started/contracts Interacting with your contracts] * [https://github.com/trufflesuite/truffle/tree/develop/packages/truffle-contract#api Truffle Contract API] * Deployer API * Assert.sol * Chai assert API * Truffle Tutorials Commands Readings * The Complete Ethereum Blockchain development Tutorials (Draft) * Building with Webpack * “SyntaxError: Unexpected token import” on truffle test (Jul 14 '17) : require Babel * Ethereum: Deploy on a Private Blockchain - truffle, geth, and private blockchains (07 Mar 2017) * truffle compile error on windows (29 Jun 2017) : truffle.cmd compile * USING INFURA (OR A CUSTOM PROVIDER) Examples * example-truffle-library : Example project showing how to use Truffle to create javascript libraries * truffle-webpack-demo : A demo Webpack + React App using truffle-solidity-loader * truffle-typescript-example : Minimal example integration of Truffle + TypeScript + TestRPC run in docker, for writing smart contracts on Ethereum blockchain. * Truffle Box : A set of boilerplates to help developers quickly build distributed applications on the Ethereum blockchain with Truffle. OpenZeppelin * https://openzeppelin.com/ * Desc. : provides tools to write, deploy and operate decentralized applications. * License : MIT * Sources : https://github.com/OpenZeppelin References Contracts * OpenZeppelin Contracts v2.x Guides * OpenZeppelin Contracts v2.x API * OpenZeppelin Contracts Sources * How to implement ERC20 supply mechanisms (Jan '19) ZeppelinOS * https://zeppelinos.org/ * Desc. : a development platform designed specifically for smart contract projects Embark * https://github.com/iurimatias/embark-framework * Desc. : Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms * License : MIT Mist Browser * https://github.com/ethereum/mist * Desc. : the tool of choice to browse and use Ðapps Ganache CLI * https://github.com/trufflesuite/ganache-cli * Desc. : simulate full client behavior and make developing Ethereum applications faster, easier, and safer. * License : MIT Remix IDE * https://github.com/ethereum/remix-ide * Desc. : a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions * License : MIT License Readings * Remix official documentation * Remix IDE + Ganache-CLI * Installing node-gyp on Windows Oraclize * http://www.oraclize.it/ * Desc. : the leading oracle service for smart contracts and blockchain applications, serving thousands of requests for day every day on Ethereum, Bitcoin and Rootstock. * License : * Readings ** Oraclzie official documentation Aleth.io * https://aleth.io/ * Desc. : * Sources : https://github.com/Alethio Readings * Alethio API Memento * https://github.com/Alethio/memento * Desc. : a tool to scrape and index data from any web3-compatible networks. * License : MIT * Memento documentation Lity * https://www.litylang.org/ * Desc. : A rule-based contract-oriented high-level language. * License : GPL-3.0 * Written in : C++ * Sources : https://github.com/second-state/lity * Components ** a dynamically extensible language : a superset of the Solidity language ** a compiler ** a virtual machine Readings * Lity documentation Ethereum plugin for Vault * https://github.com/immutability-io/vault-ethereum * Desc. : A plugin that turns Vault into an Ethereum wallet. * License : Apache-2.0 * Sources : https://github.com/immutability-io/vault-ethereum Readings * Using Vault to Build an Ethereum Wallet EthSigner * https://github.com/PegaSysEng/ethsigner/ * Desc. : A transaction signing application to be used with a web3 provider. * License : Apache-2.0 * Sources : https://github.com/PegaSysEng/ethsigner/ Readings * Protecting Your Ethereum Private Key With EthSigner (August 14, 2019) Slither * https://github.com/crytic/slither * Desc. : a Solidity static analysis framework * License : AGPL-3.0 Readings * Official documentation * Detector Documentation Solhint * https://github.com/protofire/solhint * Desc. : provides both Security and Style Guide validations. * License : MIT Readings * Official documentation * List of Rules Substrate * https://github.com/paritytech/substrate * Desc. : a next-generation framework for blockchain innovation * What is Substrate? (July 09, 2018) Ripple * https://ripple.com/ * Desc. : a network of computers which use the Ripple consensus algorithm to atomically settle and record transactions on a secure distributed database * License : ISC license * Written in : C++ * Sources : https://github.com/ripple * RPM packages : ** https://mirrors.ripple.com/rpm/ ** https://mirrors.ripple.com/rpm/el7/stable/x86_64/ * WebSocket API Tool * Data API v2 Tool References * Ripple Developer Center * Ripple Wiki * Ripple Concepts * rippled API Reference * RippleAPI Reference : the official client library to the XRP Ledger * Ripple Data API : provides access to information about changes in the XRP Ledger, including transaction history and processed analytical data * rippled-example.cfg * RocksDB option file example rippled API Consensus * [https://github.com/ripple/rippled/blob/develop/docs/consensus.md Consensus and Validation] Round Start --------------- Close -------------------- Consensus -------------------- Round End Open phase Establish phase Accept phase * The XRP Ledger Consensus Process * Consensus ** Concensus *** Through the consensus process, validating nodes agree on a specific subset of the candidate transactions to be considered for the next ledger *** Consensus is an iterative process in which nodes relay proposals, or sets of candidate transactions. *** Nodes communicate and update proposals until a supermajority 5 of peers agree on the same set of candidate transactions. ** Validation *** The validating nodes calculate a new version of the ledger and relay their results to the network, each sending a signed hash of the ledger it calculated based on the candidate transactions proposed during consensus. *** In cases where a node is in the minority, having computed a ledger that differs from its peers, the node disregards the ledger it computed 9. It recomputes the correct ledger, or retrieves the correct ledger as needed. * rippled Server States +--> full | disconnected ---> connected ---> syncing ---> tracking --| | +--> validating <-----> proposing Transaction * Reliable Transaction Submission ** [https://developers.ripple.com/reliable-transaction-submission.html#best-practices Best Practices] ** Your rippled server should automatically acquire the missing ledger versions when it has spare resources (CPU/RAM/disk IO) to do so, unless the ledgers are older than its configured amount of history to store. Depending on the size of the gap and the resource usage of your server, acquiring missing ledgers should take a few minutes. You can also manually request your server to acquire historical ledger versions using the ledger_request method. ** Use the LastLedgerSequence parameter to prevent undesirable cases where a transaction is not confirmed promptly but could be included in a future ledger. You should specify the LastLedgerSequence parameter on every transaction. Automated processes should use a value of 4 greater than the last validated ledger index to make sure that a transaction is validated or rejected in a predictable and prompt way. * Transaction submission and verification programming guideline * Transaction Common Fields * Transaction Results Ledger * Ledgers ** Ledger = Header + Transaction Tree + State Tree (Ledger Objects) ** At any given time, a rippled instance has an in-progress "current" open ledger, plus some number of closed ledgers that have not yet been approved by consensus, and any number of historical ledgers that have been validated by consensus. ** Only the validated ledgers are certain to be correct and immutable. * Ledger Data Formats ** boolean ledger.closed ** boolean ledger.accepted * Ledger Header ** Two ledgers with the same hash are always the same. ** For validated ledgers, hash values and sequence numbers are equally valid and correlate 1:1. ** Two different rippled servers may have different contents for a current ledger with the same ledger index, due to latency in propagating transactions throughout the network. ** There may be multiple closed ledger versions competing to be validated by consensus. These ledger versions have the same sequence number but different contents (and different hashes). Only one of these closed ledgers can become validated. ** A current ledger's contents change over time, which would cause its hash to change, even though its ledger index number stays the same. The hash of a ledger is not calculated until the ledger is closed. Amendments * Amendments * Known Amendments Readings * Install rippled * Forbidden from rippled while using auth credentials (12 Oct 2018) Troubleshooting * Understanding Log Messages * Diagnosing Problems with rippled Sources Stellar * https://www.stellar.org/ * Desc. : Stellar is a platform that connects banks, payments systems, and people. Integrate to move money quickly, reliably, and at almost no cost. * License : * Sources : https://github.com/stellar * Stellar on Wikipedia Hyperledger * Hyperledger Projects ** Hyperledger Cello ** Hyperledger Fabric ** Hyperledger Iroha ** Hyperledger Sawtooth Lake Hyperledger Fabric * https://github.com/hyperledger/fabric * Desc. : an implementation of blockchain technology, leveraging familiar and proven technologies. * License : Apache License Version 2.0 * Written in : Go * Docker repository : https://hub.docker.com/u/hyperledger/ * Docker images : https://github.com/hyperledger/fabric/tree/master/images * Projects ** hyperledger/fabric ** hyperledger/fabric-docs ** hyperledger/fabric-samples ** hyperledger/fabric-chaincode-java ** hyperledger/fabric-chaincode-node ** hyperledger/fabric-chaintool ** hyperledger/fabric-sdk-rest ** hyperledger/fabric-sdk-node ** hyperledger/fabric-sdk-java ** hyperledger/fabric-sdk-py ** hyperledger/fabric-sdk-go Readings * References ** Official documentation ** Transaction Flow ** Read-Write set semantics ** Bringing up a Kafka-based Ordering Service ** CLI ** Specification ** REST API * Concepts ** Channels *** Channel = Organizations + Ordering Service + Anchor Peers + Chaincodes + Ledger *** At least one anchor peer per organization * Setup ** Getting Setup ** Setting Up a Network ** Multichannel Setup ** Install and Instantiate ** v1.0.0-alpha2 *** sample configtx.yaml *** sample core.yaml *** sample orderer.yaml *** Getting Started ** v1.0.0-beta *** sample crypto-config.yaml * Ordering ** A Kafka-based Ordering Service for Fabric * Ledger ** Hyperledger Fabric V1.0: Block Structure (Part 1) * Chaincode ** What is chaincode? ** Chaincode API ** Java chaincode ** [http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup.html Writing, Building, and Running Chaincode in a Development Environment] ** Chaincode examples ** Where is Hyperledger fabric chaincode store location? (Jan 26) * SDK ** Hyperledger Fabric SDK Design Specification v1.0 * misc ** Hyperledger Fabric Approaches v1.0 with Better Scalability and Security ** Logging Control ** Hyperledger Fabric V1.0: Block Structure (Part 1) Examples * CLI based End-to-End Flow ** 1 Orderer, 3 Peer, 1 CLI ** configtx.yaml ** docker-compose.yaml ** docker-compose-no-tls.yaml ** script.sh : called by yaml file * Fabric official samples ** Build Your First Network (BYFN) * github.com/ksachdeva/hyperledger-fabric-example ** ksachdeva.github.io Demos * ITPeople Blockchain - Art Auction Demo * IBM Blockchain - Marbles Demo Sources * fabric/core/ledger/util/couchdb/couchdb.go ** 1.0.0-alpha *** handleRequest(method, connectURL string, data io.Reader, rev string, multipartBoundary string) (*http.Response, *DBReturn, error) ** 1.0.0-beta *** handleRequest(method, connectURL string, data [byte, rev string, multipartBoundary string, maxRetries int, keepConnectionOpen bool) (*http.Response, *DBReturn, error)] * fabric/core/chaincode/shim/interfaces.go ** 1.0.0-alpha *** PutState(key string, value [byte) error] *** GetState(key string) ([byte, error)] * fabric/core/ledger/ledgerconfig/ledger_config.go ** 1.0.1 Issues * FAB-6092 : Gossip error: PKIID wasn't found (10/Sep/17) * FAB-6421 : Performance and scale improvements for 1.1 (03/Oct/17) Docker Images fabric-peer Config which is printed by "docker inspect --format=' ' ..." is "Config": { "Hostname": "e7eddde82bec", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "PEER_CFG_PATH=/etc/hyperledger/fabric", "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/sampleconfig" ], "Cmd": [ "peer", "node", "start" ], "ArgsEscaped": true, "Image": "sha256:793719e9dd193f580f32c5984ac47a8c0f986819e4795c039703b26bb6ad15ce", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": [], "Labels": { "org.hyperledger.fabric.base.version": "0.3.0", "org.hyperledger.fabric.version": "1.0.0-alpha" } }, Fabric CA * Fabric CA User’s Guide * Fabric CA Server REST API Fabric SDK for Node.js * Sources : ** https://github.com/hyperledger/fabric-sdk-node ** https://github.com/hyperledger/fabric-sdk-node/tree/master/fabric-client ** https://github.com/hyperledger/fabric-sdk-node/tree/master/fabric-ca-client * Features ** create channels ** ask peer nodes to join the channel ** install chaincodes in peers ** instantiate chaincodes in a channel ** invoke transactions by calling the chaincode ** query the ledger for transactions or blocks * Readings ** Official documentation ** [https://fabric-sdk-node.github.io/ Application developer documentations] * Examples ** Balance transfer example *** https://github.com/hyperledger/fabric-sdk-node/tree/master/examples/balance-transfer Performance Tuning * JBOD or RAID * LVM (Logical Volume Manager) * Filesystem Journaling ** Disabling Journaling in Ubuntu 14.04? * ulimit, open files ** Set ulimit parameters on ubuntu (2009/06/04) ** Raising the Maximum Number of File Descriptors (Open Files) on Ubuntu 14.04 Trusty (2015/05/18) * noatime ** Reducing Disk IO By Mounting Partitions With noatime ** Is it worth to tune Ext4 with noatime? (Aug 12 '10) ** RHEL 6 Filesystem Mount Options * vm.swappiness ** Swappiness ** RHEL 6 Tuning Virtual Memory *** A low swappiness value is recommended for database workloads. ** Swap Space and Kernel Swappiness ** How do I configure swappiness? (Ask Ubuntu) * Disk I/O Scheduler ** Noop for SSD ** Linux I/O Scheduler Comparison On The Linux 3.4 Desktop(11 May 2012) ** Selecting a Linux I/O Scheduler ** Linux Change The I/O Scheduler For A Hard Disk ** SSD benchmark of I/O schedulers (April 28th, 2010) * Docker OverlayFS storage driver ** Use the OverlayFS storage driver * CouchDB ** Linux tuning for better CouchDB performance * misc ** Tuning Linux for Database performance Companions PTE * https://github.com/dongmingh/v1performance * Desc. : Performance Traffic Engine R3 Corda * https://www.corda.net/ * Desc. : The open source blockchain for business * License : Apache License, Version 2.0 * Written in : Kotlin * Sources : https://github.com/corda/corda Concepts * Key Concepts State Object ----+----> Contract Code +----> Legal Prose Features * All communication between nodes is direct, with TLS-encrypted messages sent over AMQP/1.0 ** AMQP(Advanced Message Queuing Protocol) References * Corda 3.2 Documentation * Start Coding Corda * Setup and run cordapp-example project * The example CorDapp (https://github.com/corda/cordapp-example) * The Corda Platform: An Introduction (May, 2018) * Technical White Paper (Version 0.5, November 29, 2016) * End-State Principles * Intel SGX (Software Guard Extensions) Readings * Building Blocks of the State Machine Approach to Consensus (Jun 20, 2016) * Closed Seal Sets and Truth Lists for Better Privacy and Censorship Resistance (Jun 22, 2016) Eris * https://monax.io/ * Desc. : an open platform for developers and devops to build, ship, and run blockchain-based applications for business ecosystems. * License : https://monax.io/library/#licensing * Sources : https://github.com/eris-ltd References * Eris official documentation * Eris Getting Started ** Building Your First Blockchain App with Eris (August 24, 2016) * Eris Command Line Interface * [https://monax.io/docs/documentation/db/latest/specifications/api/ Eris DB Web APIs] * Jobs Specification * Variables Specification Readings * Using Docker Machine With Eris * On Eris and Tendermint: Application and Consensus (2016/03/02) * Cannot deploy smart contract with Eris / Monax ** Could not perform pkg action service: Could not perform pkg action: Docker: {"mssage":"Cannot link to a non running container: /simplechain * The Blockchain Explained to Web Developers, Part 1: The Theory (2016/04/28) * The Blockchain Explained to Web Developers, Part 2: In Practice (2016/05/20) * The Blockchain Explained to Web Developers, Part 3: The Truth (2016/06/14) * Eris and Ethereum - Decentralized computing on a blockchain (May 20, 2015) Tendermint Core * https://tendermint.com/ * Desc. : Byzantine fault-tolerant replicated state machines in any programming language * License : Apache-2.0 * Written in : Go * Sources : https://github.com/tendermint/tendermint Readings * Documentation * The latest gossip on BFT consensus (paper, September 24, 2018) * Resources * Consensus Protocols: Tendermint and pBFT (21 JULY 2018) * Tendermint Explained — Bringing BFT-based PoS to the Public Blockchain Domain (May 11, 2018) * What is the difference between PBFT, Tendermint, SBFT and HotStuff ? (June 23, 2019) IPFS * https://ipfs.io/ * Desc. : A peer-to-peer hypermedia protocol to make the web faster, safer, and more open STO * Category: Security Token Offerings (STO’s) * 4 Tokenized security platforms to watch: Polymath, Ravencoin, Neufund and Cybermiles (Jul 31, 2018) * ERC 1400: Security Token Standard * Polymath * CyberMiles * Regulation of virtual asset trading platforms (Hongkong Securities and Futures Commission) * Offer and acceptance * ABA routing transit number * Routing number (ABA) * Routing Number vs. Account Number: What's the Difference? (Jun 25, 2019) AML * KYC: 3 Steps to Know Your Customer (MARCH 20, 2019) * Anti-Money Laundering/Combating the Financing of Terrorism (AML/CFT) (IMF) * Top 10 KYC & AML Service Providers (Aug 17, 2018) Polymath * https://polymath.network/ * Desc. : enables trillions of dollars of securities to migrate to the blockchain. * Security Token Standard CoFi OS * https://github.com/ConsenSys/ERC1400 * Desc. : an advanced institutional technology platform for issuing and exchanging tokenized financial assets, powered by the Ethereum blockchain. De-Fi MakerDAO * Sources ** https://github.com/makerdao/dss : Dai Stablecoin System - the core smart contract code for Multi Collateral Dai * The Dai Stablecoin System Whitepaper * MDC Documentation DAI * DAI ** Decentralized Stable Coin ** Backed by Ether * [https://destiner.io/longcaller/coin/dai.html Dai] ** First, Dai can be used as a stable coin ** The second use of Dai is margin trading * Dai (DAI) * What is Dai and how does it work? (May 9, 2019)